package de.koller.worlders.engine.entity.mo.npc;

public class Slime01 extends NPC {

	private long startWalking;
	private float lastXPos;
	private int walkDirection = 1;
	
	public Slime01( float x, float y ) {
		super( x+0.1f, y+0.1f, 0.8f, 0.8f );
		
		this.getWalkSpeed().getValues().put( "default", 0.00195 );
	}

	@Override
	protected void init() {
		super.init();
		
		//@todo add visual!
		//this.setTextureRep( new TextureRep( TextureRep.TextureValue.Tiles, 192, 32, 32, 32 ) );
		this.startWalking = this.wroot.getTime() + 2000;
		this.lastXPos = this.getPosition().getXf();
	}

	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		if( startWalking > this.wroot.getTime() )
			return;

		if( lastXPos == this.getPosition().getXf() )
			walkDirection *= -1;

		this.walk( walkDirection );
		lastXPos = this.getPosition().getXf();
	}

	
}
